/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CreateXMLWindow.java
 *
 * Created on Mar 25, 2011, 11:42:39 AM
 */

package org.dlsu.pdfgen.gui;

import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;

import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import java.io.*;
import java.text.NumberFormat;
import java.awt.Dimension;
import java.awt.Rectangle;

/**
 * 
 * @author Alvin
 */
public class CreateXMLWindow extends javax.swing.JDialog {

	/** Creates new form CreateXMLWindow */
	public CreateXMLWindow(java.awt.Frame parent, boolean modal) {
		super(parent,modal);
		initComponents();
		Dimension dim = getToolkit().getScreenSize();
        Rectangle abounds = getBounds();
        setLocation((dim.width - abounds.width) / 2, (dim.height - abounds.height) / 2);
		System.out.println("GUI started.");
		setVisible(true);
		setLocationRelativeTo(null);

	}

	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		XMLTabbedPane = new javax.swing.JTabbedPane();
		jPanel1 = new javax.swing.JPanel();
		jLabel7 = new javax.swing.JLabel();
		jLabel5 = new javax.swing.JLabel();
		jLabel6 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		jLabel9 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jLabel8 = new javax.swing.JLabel();
		jLabel2 = new javax.swing.JLabel();
		courseCodeTxtField = new javax.swing.JTextField();
		courseTitleTxtField = new javax.swing.JTextField();
		coursePreRequisiteTxtField = new javax.swing.JTextField();
		courseTypeTxtField = new javax.swing.JTextField();
		facultyTxtField = new javax.swing.JTextField();
		termTxtField = new javax.swing.JTextField();
		timeTxtField = new javax.swing.JTextField();
		roomTxtField = new javax.swing.JTextField();
		jPanel2 = new javax.swing.JPanel();
		jScrollPane1 = new javax.swing.JScrollPane();
		descriptionTxtArea = new javax.swing.JTextArea();
		jPanel3 = new javax.swing.JPanel();
		jPanel9 = new javax.swing.JPanel();
		jScrollPane2 = new javax.swing.JScrollPane();
		preambleTxtArea = new javax.swing.JTextArea();
		jPanel10 = new javax.swing.JPanel();
		jScrollPane3 = new javax.swing.JScrollPane();
		objectiveListModel = new DefaultListModel();
		objectivesList = new javax.swing.JList(objectiveListModel);
		objectiveRemoveButton = new javax.swing.JButton();
		objectiveAddButton = new javax.swing.JButton();
		objectiveTxtField = new javax.swing.JTextField();
		jPanel4 = new javax.swing.JPanel();
		jScrollPane4 = new javax.swing.JScrollPane();
		topicTableModel = new DefaultTableModel();
		topicsTable = new javax.swing.JTable();
		topicsTable.setModel(topicTableModel);
		jLabel10 = new javax.swing.JLabel();
		jLabel11 = new javax.swing.JLabel();
		jLabel12 = new javax.swing.JLabel();
		topicWeekTxtField = new javax.swing.JFormattedTextField(NumberFormat.getInstance());
		topicNameTxtField = new javax.swing.JTextField();
		topicHoursTxtField = new javax.swing.JFormattedTextField(NumberFormat.getInstance());
		topicAddButton = new javax.swing.JButton();
		topicRemoveButton = new javax.swing.JButton();
		jPanel5 = new javax.swing.JPanel();
		jScrollPane5 = new javax.swing.JScrollPane();
		requirementListModel = new DefaultListModel();
		requirementList = new javax.swing.JList(requirementListModel);
		requirementRemoveButton = new javax.swing.JButton();
		requirementAddButton = new javax.swing.JButton();
		requirementTxtField = new javax.swing.JTextField();
		jLabel15 = new javax.swing.JLabel();
		RequirmentListTypeComboBox = new javax.swing.JComboBox();
		jPanel6 = new javax.swing.JPanel();
		jScrollPane6 = new javax.swing.JScrollPane();
		assessmentTableModel = new DefaultTableModel();
		assessmentTable = new javax.swing.JTable(assessmentTableModel);
		jLabel13 = new javax.swing.JLabel();
		jLabel14 = new javax.swing.JLabel();
		assessmentItemTxtField = new javax.swing.JTextField();
		assessmentValueTxtField = new javax.swing.JTextField();
		assessmentRemoveButton = new javax.swing.JButton();
		assessmentAddButton = new javax.swing.JButton();
		jPanel7 = new javax.swing.JPanel();
		textMaterialComboBox = new javax.swing.JComboBox();
		jLabel16 = new javax.swing.JLabel();
		textMaterialTxtField = new javax.swing.JTextField();
		jScrollPane7 = new javax.swing.JScrollPane();
		textMaterialListModel = new DefaultListModel();
		textMaterialList = new javax.swing.JList(textMaterialListModel);
		textMaterialRemoveButton = new javax.swing.JButton();
		textMaterialAddButton = new javax.swing.JButton();
		jPanel8 = new javax.swing.JPanel();
		referenceTxtField = new javax.swing.JTextField();
		referenceScrollPane = new javax.swing.JScrollPane();
		referenceListModel = new DefaultListModel();
		referenceList = new javax.swing.JList(referenceListModel);
		referenceRemoveButton = new javax.swing.JButton();
		referenceAddButton = new javax.swing.JButton();
		clearButton = new javax.swing.JButton();
		saveButton = new javax.swing.JButton();
		closeButton = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		setTitle("Create XML");
		setResizable(false);

		jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
		jLabel1.setText("Create XML");

		jLabel7.setText("Term");

		jLabel5.setText("Course Type");

		jLabel6.setText("Faculty");

		jLabel4.setText("Course Pre-requisite");

		jLabel9.setText("Room");

		jLabel3.setText("Course Title");

		jLabel8.setText("Time");

		jLabel2.setText("Course Code");

		courseCodeTxtField
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						courseCodeTxtFieldActionPerformed(evt);
					}
				});

		courseTitleTxtField
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						courseTitleTxtFieldActionPerformed(evt);
					}
				});

		coursePreRequisiteTxtField
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						coursePreRequisiteTxtFieldActionPerformed(evt);
					}
				});

		courseTypeTxtField
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						courseTypeTxtFieldActionPerformed(evt);
					}
				});

		facultyTxtField.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				facultyTxtFieldActionPerformed(evt);
			}
		});

		termTxtField.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				termTxtFieldActionPerformed(evt);
			}
		});

		timeTxtField.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				timeTxtFieldActionPerformed(evt);
			}
		});

		roomTxtField.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				roomTxtFieldActionPerformed(evt);
			}
		});

		closeButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});

		clearButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if (JOptionPane.showConfirmDialog(null,
						"Data may be lost! Confirm?", "Clear",
						JOptionPane.YES_NO_OPTION) == 0) {
					dispose();
					new CreateXMLWindow(parent, modal);
				}
			}
		});

		objectiveAddButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						objectiveListModel.addElement(objectiveTxtField
								.getText());
						objectiveTxtField.setText("");
					}
				});

		objectiveRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent arg0) {

						for (int i = objectivesList.getModel().getSize() - 1; i >= 0; i--)
							if (objectivesList.isSelectedIndex(i))
								objectiveListModel.remove(i);
					}
				});

		requirementAddButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent e) {
						requirementListModel.addElement(requirementTxtField
								.getText());
						requirementTxtField.setText("");
					}
				});

		requirementRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent e) {
						for (int i = requirementList.getModel().getSize() - 1; i >= 0; i--)
							if (requirementList.isSelectedIndex(i))
								requirementListModel.remove(i);
					}
				});

		referenceAddButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						referenceListModel.addElement(referenceTxtField
								.getText());
						referenceTxtField.setText("");
					}
				});

		referenceRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent arg0) {

						for (int i = referenceList.getModel().getSize() - 1; i >= 0; i--)
							if (referenceList.isSelectedIndex(i))
								referenceListModel.remove(i);
					}
				});

		textMaterialAddButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						textMaterialListModel.addElement(textMaterialTxtField
								.getText());
						textMaterialTxtField.setText("");
					}
				});

		textMaterialRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent arg0) {

						for (int i = textMaterialList.getModel().getSize() - 1; i >= 0; i--)
							if (textMaterialList.isSelectedIndex(i))
								textMaterialListModel.remove(i);
					}
				});

		topicAddButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent arg0) {			
				boolean error = false;				
				
				if (!topicWeekTxtField.getText().trim().equals("") && !topicNameTxtField.getText().trim().equals("") && !topicHoursTxtField.getText().trim().equals("")) {
					if(!isNumeric(topicWeekTxtField.getText().trim()) || !isNumeric(topicHoursTxtField.getText().trim())){
						JOptionPane.showMessageDialog(null,							
								"Week and Hours must be numeric.");
						if(!isNumeric(topicWeekTxtField.getText().trim()))
							topicWeekTxtField.setText("");		
						if(!isNumeric(topicHoursTxtField.getText().trim()))
							topicHoursTxtField.setText("");		
						error = true;
					}
					else{
						((DefaultTableModel) topicsTable.getModel())
								.addRow(new Object[] { topicWeekTxtField.getText(),
										topicNameTxtField.getText(),
										topicHoursTxtField.getText() });
						topicWeekTxtField.setText("");
						topicNameTxtField.setText("");
						topicHoursTxtField.setText("");
					}
				}
				else if(!error){
					JOptionPane.showMessageDialog(null,
							"Please fill up all forms.");
					error = true;
				}				
			}
		});
		
	
		topicRemoveButton
		.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if (topicsTable.getSelectedRow() != -1)
					((DefaultTableModel) topicsTable.getModel()).removeRow(topicsTable.getSelectedRow());
			}
		});
		

		assessmentAddButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						((DefaultTableModel) assessmentTable.getModel())
								.addRow(new Object[] {
										assessmentItemTxtField.getText(),
										assessmentValueTxtField.getText() });
						assessmentItemTxtField.setText("");
						assessmentValueTxtField.setText("");
					}
				});
////////////////
		saveButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent arg0) { 
				saveButtonActionPerformed(arg0); }
			}
		);
////////////////
		javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
				jPanel1);
		jPanel1.setLayout(jPanel1Layout);
		jPanel1Layout
				.setHorizontalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(jLabel5)
														.addComponent(jLabel3)
														.addComponent(jLabel2)
														.addComponent(jLabel4)
														.addComponent(jLabel6)
														.addComponent(jLabel7)
														.addComponent(jLabel8)
														.addComponent(jLabel9))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																courseCodeTxtField,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																317,
																Short.MAX_VALUE)
														.addComponent(
																courseTitleTxtField,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																317,
																Short.MAX_VALUE)
														.addComponent(
																coursePreRequisiteTxtField,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																317,
																Short.MAX_VALUE)
														.addComponent(
																courseTypeTxtField,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																317,
																Short.MAX_VALUE)
														.addComponent(
																facultyTxtField,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																317,
																Short.MAX_VALUE)
														.addGroup(
																jPanel1Layout
																		.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.TRAILING,
																				false)
																		.addComponent(
																				roomTxtField,
																				javax.swing.GroupLayout.Alignment.LEADING)
																		.addComponent(
																				timeTxtField,
																				javax.swing.GroupLayout.Alignment.LEADING)
																		.addComponent(
																				termTxtField,
																				javax.swing.GroupLayout.Alignment.LEADING,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				143,
																				javax.swing.GroupLayout.PREFERRED_SIZE)))
										.addContainerGap()));
		jPanel1Layout
				.setVerticalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel2)
														.addComponent(
																courseCodeTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel3)
														.addComponent(
																courseTitleTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel4)
														.addComponent(
																coursePreRequisiteTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel5)
														.addComponent(
																courseTypeTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel6)
														.addComponent(
																facultyTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel7)
														.addComponent(
																termTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel8)
														.addComponent(
																timeTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel9)
														.addComponent(
																roomTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap(88, Short.MAX_VALUE)));

		XMLTabbedPane.addTab("Details", jPanel1);

		descriptionTxtArea.setColumns(20);
		descriptionTxtArea.setFont(new java.awt.Font("Tahoma", 0, 11));
		descriptionTxtArea.setRows(5);
		descriptionTxtArea.setCursor(new java.awt.Cursor(
				java.awt.Cursor.TEXT_CURSOR));
		jScrollPane1.setViewportView(descriptionTxtArea);

		javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(
				jPanel2);
		jPanel2.setLayout(jPanel2Layout);
		jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel2Layout
						.createSequentialGroup()
						.addContainerGap()
						.addComponent(jScrollPane1,
								javax.swing.GroupLayout.DEFAULT_SIZE, 419,
								Short.MAX_VALUE).addContainerGap()));
		jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel2Layout
						.createSequentialGroup()
						.addContainerGap()
						.addComponent(jScrollPane1,
								javax.swing.GroupLayout.DEFAULT_SIZE, 279,
								Short.MAX_VALUE).addContainerGap()));

		XMLTabbedPane.addTab("Description", jPanel2);

		jPanel9.setBorder(javax.swing.BorderFactory
				.createTitledBorder("Preamble"));

		preambleTxtArea.setColumns(20);
		preambleTxtArea.setFont(new java.awt.Font("Tahoma", 0, 11));
		preambleTxtArea.setRows(3);
		jScrollPane2.setViewportView(preambleTxtArea);

		javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(
				jPanel9);
		jPanel9.setLayout(jPanel9Layout);
		jPanel9Layout.setHorizontalGroup(jPanel9Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel9Layout
						.createSequentialGroup()
						.addContainerGap()
						.addComponent(jScrollPane2,
								javax.swing.GroupLayout.DEFAULT_SIZE, 387,
								Short.MAX_VALUE).addContainerGap()));
		jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel9Layout
						.createSequentialGroup()
						.addContainerGap()
						.addComponent(jScrollPane2,
								javax.swing.GroupLayout.PREFERRED_SIZE, 69,
								javax.swing.GroupLayout.PREFERRED_SIZE)
						.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE)));

		jPanel10.setBorder(javax.swing.BorderFactory
				.createTitledBorder("Objectives"));

		jScrollPane3.setViewportView(objectivesList);

		objectiveRemoveButton.setText("Remove");

		objectiveAddButton.setText("Add");

		javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(
				jPanel10);
		jPanel10.setLayout(jPanel10Layout);
		jPanel10Layout
				.setHorizontalGroup(jPanel10Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel10Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel10Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jScrollPane3,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																387,
																Short.MAX_VALUE)
														.addGroup(
																jPanel10Layout
																		.createSequentialGroup()
																		.addComponent(
																				objectiveTxtField,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				253,
																				Short.MAX_VALUE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				objectiveAddButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				objectiveRemoveButton)))
										.addContainerGap()));
		jPanel10Layout
				.setVerticalGroup(jPanel10Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel10Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jScrollPane3,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												77, Short.MAX_VALUE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel10Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																objectiveRemoveButton)
														.addComponent(
																objectiveAddButton)
														.addComponent(
																objectiveTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap()));

		javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(
				jPanel3);
		jPanel3.setLayout(jPanel3Layout);
		jPanel3Layout
				.setHorizontalGroup(jPanel3Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel3Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel3Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jPanel10,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE)
														.addComponent(
																jPanel9,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE))
										.addContainerGap()));
		jPanel3Layout
				.setVerticalGroup(jPanel3Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel3Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jPanel9,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jPanel10,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addContainerGap()));

		XMLTabbedPane.addTab("Objectives", jPanel3);

		topicsTable.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {

				}, new String[] { "Week", "Name", "Hours" }) {
			boolean[] canEdit = new boolean[] { false, false, false };

			public boolean isCellEditable(int rowIndex, int columnIndex) {
				return canEdit[columnIndex];
			}
		});
		jScrollPane4.setViewportView(topicsTable);

		jLabel10.setText("Week");

		jLabel11.setText("Name");

		jLabel12.setText("Hours");

		topicWeekTxtField
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						topicWeekTextFieldActionPerformed(evt);
					}
				});

		topicAddButton.setText("Add");
		topicAddButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				topicAddButtonActionPerformed(evt);
			}
		});

		topicRemoveButton.setText("Remove");
		topicRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						topicRemoveButtonActionPerformed(evt);
					}
				});

		javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(
				jPanel4);
		jPanel4.setLayout(jPanel4Layout);
		jPanel4Layout
				.setHorizontalGroup(jPanel4Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel4Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel4Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jScrollPane4,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																419,
																Short.MAX_VALUE)
														.addGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																jPanel4Layout
																		.createSequentialGroup()
																		.addGroup(
																				jPanel4Layout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.TRAILING)
																						.addComponent(
																								jLabel10)
																						.addComponent(
																								jLabel11)
																						.addComponent(
																								jLabel12))
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																		.addGroup(
																				jPanel4Layout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								topicHoursTxtField,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								381,
																								Short.MAX_VALUE)
																						.addComponent(
																								topicNameTxtField,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								381,
																								Short.MAX_VALUE)
																						.addComponent(
																								topicWeekTxtField,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								381,
																								Short.MAX_VALUE)))
														.addGroup(
																jPanel4Layout
																		.createSequentialGroup()
																		.addComponent(
																				topicAddButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				topicRemoveButton)))
										.addContainerGap()));
		jPanel4Layout
				.setVerticalGroup(jPanel4Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel4Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jScrollPane4,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												172, Short.MAX_VALUE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel4Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel10)
														.addComponent(
																topicWeekTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel4Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel11)
														.addComponent(
																topicNameTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel4Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel12)
														.addComponent(
																topicHoursTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel4Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																topicRemoveButton)
														.addComponent(
																topicAddButton))
										.addContainerGap()));

		XMLTabbedPane.addTab("Topics", jPanel4);

		jScrollPane5.setViewportView(requirementList);

		requirementRemoveButton.setText("Remove");
		requirementRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						requirementRemoveButtonActionPerformed(evt);
					}
				});

		requirementAddButton.setText("Add");

		jLabel15.setText("List Type");

		RequirmentListTypeComboBox
				.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
						"Numbered", "Bulleted" }));

		javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(
				jPanel5);
		jPanel5.setLayout(jPanel5Layout);
		jPanel5Layout
				.setHorizontalGroup(jPanel5Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel5Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel5Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jScrollPane5,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																419,
																Short.MAX_VALUE)
														.addGroup(
																jPanel5Layout
																		.createSequentialGroup()
																		.addComponent(
																				requirementTxtField,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				285,
																				Short.MAX_VALUE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				requirementAddButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				requirementRemoveButton))
														.addGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																jPanel5Layout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel15)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				RequirmentListTypeComboBox,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				109,
																				javax.swing.GroupLayout.PREFERRED_SIZE)))
										.addContainerGap()));
		jPanel5Layout
				.setVerticalGroup(jPanel5Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel5Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel5Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel15)
														.addComponent(
																RequirmentListTypeComboBox,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jScrollPane5,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												224, Short.MAX_VALUE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel5Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																requirementRemoveButton)
														.addComponent(
																requirementAddButton)
														.addComponent(
																requirementTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap()));

		XMLTabbedPane.addTab("Requirements", jPanel5);

		assessmentTable.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {

				}, new String[] { "Item", "Value" }) {
			boolean[] canEdit = new boolean[] { false, false };

			public boolean isCellEditable(int rowIndex, int columnIndex) {
				return canEdit[columnIndex];
			}
		});
		jScrollPane6.setViewportView(assessmentTable);

		jLabel13.setText("Item");

		jLabel14.setText("Value");

		assessmentItemTxtField
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						assessmentItemTxtFieldActionPerformed(evt);
					}
				});

		assessmentRemoveButton.setText("Remove");

		assessmentAddButton.setText("Add");

		javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(
				jPanel6);
		jPanel6.setLayout(jPanel6Layout);
		jPanel6Layout
				.setHorizontalGroup(jPanel6Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel6Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel6Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jScrollPane6,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																419,
																Short.MAX_VALUE)
														.addGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																jPanel6Layout
																		.createSequentialGroup()
																		.addGroup(
																				jPanel6Layout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.TRAILING)
																						.addComponent(
																								jLabel13)
																						.addComponent(
																								jLabel14))
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																		.addGroup(
																				jPanel6Layout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								assessmentValueTxtField,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								383,
																								Short.MAX_VALUE)
																						.addComponent(
																								assessmentItemTxtField,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								383,
																								Short.MAX_VALUE)))
														.addGroup(
																jPanel6Layout
																		.createSequentialGroup()
																		.addComponent(
																				assessmentAddButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				assessmentRemoveButton)))
										.addContainerGap()));
		jPanel6Layout
				.setVerticalGroup(jPanel6Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel6Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jScrollPane6,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												198, Short.MAX_VALUE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel6Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel13)
														.addComponent(
																assessmentItemTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel6Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																assessmentValueTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(jLabel14))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel6Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																assessmentRemoveButton)
														.addComponent(
																assessmentAddButton))
										.addContainerGap()));

		XMLTabbedPane.addTab("Assessment", jPanel6);

		textMaterialComboBox.setModel(new javax.swing.DefaultComboBoxModel(
				new String[] { "Numbered", "Bulleted" }));

		jLabel16.setText("List Type");

		jScrollPane7.setViewportView(textMaterialList);

		textMaterialRemoveButton.setText("Remove");
		textMaterialRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						jButton9ActionPerformed(evt);
					}
				});

		textMaterialAddButton.setText("Add");

		javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(
				jPanel7);
		jPanel7.setLayout(jPanel7Layout);
		jPanel7Layout
				.setHorizontalGroup(jPanel7Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel7Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel7Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jScrollPane7,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																419,
																Short.MAX_VALUE)
														.addGroup(
																jPanel7Layout
																		.createSequentialGroup()
																		.addComponent(
																				textMaterialTxtField,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				285,
																				Short.MAX_VALUE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				textMaterialAddButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				textMaterialRemoveButton))
														.addGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																jPanel7Layout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel16)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				textMaterialComboBox,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				109,
																				javax.swing.GroupLayout.PREFERRED_SIZE)))
										.addContainerGap()));
		jPanel7Layout
				.setVerticalGroup(jPanel7Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel7Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel7Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel16)
														.addComponent(
																textMaterialComboBox,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jScrollPane7,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												224, Short.MAX_VALUE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel7Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																textMaterialRemoveButton)
														.addComponent(
																textMaterialAddButton)
														.addComponent(
																textMaterialTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap()));

		XMLTabbedPane.addTab("Text/Materials", jPanel7);

		referenceScrollPane.setViewportView(referenceList);

		referenceRemoveButton.setText("Remove");
		referenceRemoveButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						jButton11ActionPerformed(evt);
					}
				});

		referenceAddButton.setText("Add");

		javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(
				jPanel8);
		jPanel8.setLayout(jPanel8Layout);
		jPanel8Layout
				.setHorizontalGroup(jPanel8Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGap(0, 439, Short.MAX_VALUE)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel8Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel8Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																referenceScrollPane,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																419,
																Short.MAX_VALUE)
														.addGroup(
																jPanel8Layout
																		.createSequentialGroup()
																		.addComponent(
																				referenceTxtField,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				285,
																				Short.MAX_VALUE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				referenceAddButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				referenceRemoveButton)))
										.addContainerGap()));
		jPanel8Layout
				.setVerticalGroup(jPanel8Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel8Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												referenceScrollPane,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												250, Short.MAX_VALUE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel8Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																referenceRemoveButton)
														.addComponent(
																referenceAddButton)
														.addComponent(
																referenceTxtField,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap()));

		XMLTabbedPane.addTab("References", jPanel8);

		clearButton.setText("Clear");

		saveButton.setText("Save");

		closeButton.setText("Close");

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup().addContainerGap()
								.addComponent(jLabel1)
								.addContainerGap(354, Short.MAX_VALUE))
				.addGroup(
						javax.swing.GroupLayout.Alignment.TRAILING,
						layout.createSequentialGroup()
								.addContainerGap()
								.addComponent(clearButton)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED,
										245, Short.MAX_VALUE)
								.addComponent(closeButton)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(saveButton).addContainerGap())
				.addComponent(XMLTabbedPane,
						javax.swing.GroupLayout.DEFAULT_SIZE, 444,
						Short.MAX_VALUE));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addComponent(jLabel1)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(XMLTabbedPane,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										345, Short.MAX_VALUE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(saveButton)
												.addComponent(closeButton)
												.addComponent(clearButton))
								.addContainerGap()));

		pack();
	}// </editor-fold>

////////////
	private void saveButtonActionPerformed(ActionEvent arg0) {
		try {
			OutputStream fout;
			JFileChooser xmlDestination = new JFileChooser();
			if (xmlDestination.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
				if (xmlDestination.getSelectedFile().getAbsolutePath().endsWith(".xml")) {
					fout = new FileOutputStream(
							xmlDestination.getSelectedFile().getAbsolutePath());
					}
				else {
					fout = new FileOutputStream(
						xmlDestination.getSelectedFile().getAbsolutePath() + ".xml");
				}

			//OutputStream fout = new FileOutputStream("generated.xml");
			OutputStream bout = new BufferedOutputStream(fout);
			OutputStreamWriter out = new OutputStreamWriter(bout);

			out.write("<?xml version=\"1.0\"?>\n");
			out.write("<syllabus>\n");
			out.write("\t<code>" + courseCodeTxtField.getText()
					+ "</code>\n");
			out.write("\t<title>" + courseTitleTxtField.getText()
					+ "</title>\n");
			out.write("\t<prereqs>\n");
			out.write("\t\t<pre>"
					+ coursePreRequisiteTxtField.getText() + "</pre>\n");
			out.write("\t</prereqs>\n");
			out.write("\t<postreqs>\n");
			out.write("\t\t<post></post>\n");
			out.write("\t</postreqs>\n");
			out.write("\t<type>" + courseTypeTxtField.getText()
					+ "</type>\n");
			out.write("\t<faculty>" + facultyTxtField.getText()
					+ "</faculty>\n");
			out.write("\t<term>" + termTxtField.getText() + "</term>\n");
			out.write("\t<time>" + timeTxtField.getText() + "</time>\n");
			out.write("\t<room>" + roomTxtField.getText() + "</room>\n");

			out.write("\t<coursedesc>" + descriptionTxtArea.getText()
					+ "</coursedesc>\n");

			out.write("\t<objectives>\n");
			out.write("\t\t<preamble>" + preambleTxtArea.getText()
					+ "</preamble>\n");
			for (int i = 0; i < objectivesList.getModel().getSize(); i++)
				out.write("\t\t<objective>"
						+ objectivesList.getModel().getElementAt(i)
						+ "</objective>\n");
			out.write("\t</objectives>\n");

			out.write("\t<topics>\n");
			for (int i = 0; i < topicsTable.getRowCount(); i++) {
				out.write("\t\t<topic>\n");
				out.write("\t\t\t\t<week>"
						+ topicsTable.getModel().getValueAt(i, 0)
						+ "</week>\n");
				out.write("\t\t\t\t<name>"
						+ topicsTable.getModel().getValueAt(i, 1)
						+ "</name>\n");
				out.write("\t\t\t\t<hour>"
						+ topicsTable.getModel().getValueAt(i, 2)
						+ "</hour>\n");
				out.write("\t\t</topic>\n");
			}
			out.write("\t</topics>\n");

			out.write("\t<requirements listType=\""
					+ (String) RequirmentListTypeComboBox
							.getSelectedItem() + "\">\n");
			for (int i = 0; i < requirementList.getModel().getSize(); i++)
				out.write("\t\t<req>"
						+ requirementList.getModel().getElementAt(i)
						+ "</req>\n");
			out.write("\t</requirements>\n");

			out.write("\t<assessments>\n");
			for (int i = 0; i < assessmentTable.getRowCount(); i++) {
				out.write("\t\t<assessment>\n");
				out.write("\t\t\t\t<item>"
						+ assessmentTable.getModel().getValueAt(i, 0)
						+ "</item>\n");
				out.write("\t\t\t\t<value>"
						+ assessmentTable.getModel().getValueAt(i, 1)
						+ "</value>\n");
				out.write("\t\t</assessment>\n");
			}
			out.write("\t</assessments>\n");

			out.write("\t<materials listType=\""
					+ (String) textMaterialComboBox.getSelectedItem()
					+ "\">\n");
			for (int i = 0; i < textMaterialList.getModel().getSize(); i++)
				out.write("\t\t<material>"
						+ textMaterialList.getModel().getElementAt(i)
						+ "</material>\n");
			out.write("\t</materials>\n");

			out.write("\t<references>\n");
			for (int i = 0; i < referenceList.getModel().getSize(); i++)
				out.write("\t\t<ref>"
						+ referenceList.getModel().getElementAt(i)
						+ "</ref>\n");
			out.write("\t</references>\n");

			out.write("</syllabus>");
			out.flush();
			out.close();
			System.out.println("XML Generated");
			this.setVisible(false);
			} //end of if
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static boolean isNumeric(String str)
	{
	  return str.matches("\\d+(\\.\\d+)?");  //match a number with optional '-' and decimal.
	}
///////////
	private void courseCodeTxtFieldActionPerformed(
			java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void courseTitleTxtFieldActionPerformed(
			java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void coursePreRequisiteTxtFieldActionPerformed(
			java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void courseTypeTxtFieldActionPerformed(
			java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void facultyTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void termTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void timeTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void roomTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void requirementRemoveButtonActionPerformed(
			java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void topicWeekTextFieldActionPerformed(
			java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void topicAddButtonActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void topicRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void assessmentItemTxtFieldActionPerformed(
			java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	/*
	 * public static void main(String args[]) {
	 * java.awt.EventQueue.invokeLater(new Runnable() { public void run() { }
	 * }); }
	 */

	// Variables declaration - do not modify
	private javax.swing.JComboBox RequirmentListTypeComboBox;
	private javax.swing.JTabbedPane XMLTabbedPane;
	private javax.swing.JButton assessmentAddButton;
	private javax.swing.JTextField assessmentItemTxtField;
	private javax.swing.JButton assessmentRemoveButton;
	private javax.swing.JTable assessmentTable;
	private javax.swing.JTextField assessmentValueTxtField;
	private javax.swing.JButton clearButton;
	private javax.swing.JButton closeButton;
	private javax.swing.JTextField courseCodeTxtField;
	private javax.swing.JTextField coursePreRequisiteTxtField;
	private javax.swing.JTextField courseTitleTxtField;
	private javax.swing.JTextField courseTypeTxtField;
	private javax.swing.JTextArea descriptionTxtArea;
	private javax.swing.JTextField facultyTxtField;
	private javax.swing.JButton textMaterialAddButton;
	private javax.swing.JButton referenceRemoveButton;
	private javax.swing.JButton referenceAddButton;
	private javax.swing.JButton textMaterialRemoveButton;
	private javax.swing.JComboBox textMaterialComboBox;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel10;
	private javax.swing.JLabel jLabel11;
	private javax.swing.JLabel jLabel12;
	private javax.swing.JLabel jLabel13;
	private javax.swing.JLabel jLabel14;
	private javax.swing.JLabel jLabel15;
	private javax.swing.JLabel jLabel16;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel7;
	private javax.swing.JLabel jLabel8;
	private javax.swing.JLabel jLabel9;
	private javax.swing.JList textMaterialList;
	private javax.swing.JList referenceList;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JPanel jPanel10;
	private javax.swing.JPanel jPanel2;
	private javax.swing.JPanel jPanel3;
	private javax.swing.JPanel jPanel4;
	private javax.swing.JPanel jPanel5;
	private javax.swing.JPanel jPanel6;
	private javax.swing.JPanel jPanel7;
	private javax.swing.JPanel jPanel8;
	private javax.swing.JPanel jPanel9;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JScrollPane jScrollPane2;
	private javax.swing.JScrollPane jScrollPane3;
	private javax.swing.JScrollPane jScrollPane4;
	private javax.swing.JScrollPane jScrollPane5;
	private javax.swing.JScrollPane jScrollPane6;
	private javax.swing.JScrollPane jScrollPane7;
	private javax.swing.JScrollPane referenceScrollPane;
	private javax.swing.JTextField textMaterialTxtField;
	private javax.swing.JTextField referenceTxtField;
	private javax.swing.JButton objectiveAddButton;
	private javax.swing.JButton objectiveRemoveButton;
	private javax.swing.JTextField objectiveTxtField;
	private javax.swing.JList objectivesList;
	private javax.swing.JTextArea preambleTxtArea;
	private javax.swing.JButton requirementAddButton;
	private javax.swing.JList requirementList;
	private javax.swing.JButton requirementRemoveButton;
	private javax.swing.JTextField requirementTxtField;
	private javax.swing.JTextField roomTxtField;
	private javax.swing.JButton saveButton;
	private javax.swing.JTextField termTxtField;
	private javax.swing.JTextField timeTxtField;
	private javax.swing.JButton topicAddButton;
	private javax.swing.JFormattedTextField topicHoursTxtField;
	private javax.swing.JTextField topicNameTxtField;
	private javax.swing.JButton topicRemoveButton;
	private javax.swing.JFormattedTextField topicWeekTxtField;
	private javax.swing.JTable topicsTable;
	private java.awt.Frame parent;
	private boolean modal;
	// End of variables declaration

	private DefaultListModel objectiveListModel;
	private DefaultListModel requirementListModel;
	private DefaultListModel textMaterialListModel;
	private DefaultListModel referenceListModel;
	private DefaultTableModel assessmentTableModel;
	private DefaultTableModel topicTableModel;
}
